<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>我的店铺</title>
<link rel="stylesheet" type="text/css" href="#{$smarty.const.APP}#/View/template/home/css/hui.css" />
<style type="text/css">
/* 自定义样式  */
.hui-hot-sreach {
	background: #FFFFFF;
	padding: 12px;
}
.hui-hot-sreach-title {
	line-height: 38px;
	font-size: 15px;
	font-weight: 700;
}
.hui-hot-sreach-keys {
	margin-top: 8px;
}
.hui-hot-sreach-keys a {
	display: block;
	border-radius: 5px;
	float: left;
	margin: 0 8px 10px 0px;
	padding: 6px 10px;
	line-height: 20px;
	font-size: 13px;
	background: #EFF3F6;
}
</style>
</head>
<body>
<header class="hui-header">
  <div id="hui-back"></div>
	<h1>我的店铺</h1>
  <!--<div id="hui-header-sreach">
    <div id="hui-header-sreach-icon"></div>
    <form>
      <input type="search" value="#{$name}#" id="searchKey" onkeydown="if(event.keyCode==13)return false;" placeholder="请输你要找的商品" />
    </form>
  </div>-->
  <div id="hui-header-menu"></div>
</header>
<div class="hui-center-title" style="margin-top:30px;"></div>
<style>
#list2 li{width:50%; float:left; 0px;}
#list2 .hui-img-list-content{padding:5px; padding-bottom:10px;}
#list2 h1{font-size:14px;}
</style>

<div class="hui-wrap">
	<div class="hui-media-list" style="padding:10px;">
	  <ul>
		 #{foreach from=$list key=k item=v}#
		<li>
		  <div class="hui-media-list-img" style="max-height: 70px;"><img src="#{$v.img1}#" /></div>
		  <div class="hui-media-content">
			  <div class="hui-row">
			  		<div class="hui-col-9">#{$v.name}#</div>
			  		<div class="hui-col-3 hui-font-red">#{$v.price}#</div>
			  </div>
			  <div class="hui-row">
			  		<div class="hui-col-8">库存:#{$v.stock}#</div>
			  		<div class="hui-col-4">
						<a href="#{$smarty.const.ACT}#/home/WxProduct/product_modify/id/#{$v.id}#/"><span class="hui-icons hui-icons-write" >修改</span></a>
		  <span class="hui-icons hui-icons-remove" onclick="set_del(#{$v.id}#)">删除</span></div>
			  </div>
		  </div>
		</li>
		#{/foreach}#
	  </ul>
	</div>
</div>
<div id="hui-footer">
	  <div style="width: 30%"></div>
	  <div style="width: 60%">
		  <a href="#{$smarty.const.ACT}#/home/WxProduct/product_add/shop_id/#{$shop.id}#/">
			<img src="#{$smarty.const.APP}#/View/template/home/img/list/pro_add.png" height="40"/> 
	  		</a> 
	  </div>
	<div style="width: 20%"></div>
</div>
<input type="hidden" name="shop_id" id="shop_id" value="#{$shop.id}#">
<script src="#{$smarty.const.APP}#/View/template/home/js/hui.js" type="text/javascript" charset="utf-8"></script> 
<script type="text/javascript">
var meuns	 = ['商家订单', '发布产品', '修改店铺'];
var cancel   = '关闭菜单';
var shop_id  =hui('#shop_id').val();
hui('#hui-header-menu').click(function(){
	hui.actionSheet(meuns, cancel, function(e){
		if(e.index==0){
			window.location.href='#{$smarty.const.ACT}#/home/WxProductOrder/product_order_shop/';
		}else if(e.index==1){
			window.location.href='#{$smarty.const.ACT}#/home/WxProduct/product_add/shop_id/'+shop_id+'/';
		}else if(e.index==2){
			window.location.href='#{$smarty.const.ACT}#/home/WxShop/shop_modify/id/'+shop_id+'/';
		}
	});
});
	
//删除产品
function set_del(id){
	hui.ajax({
		type : 'POST',
		url : '#{$smarty.const.ACT}#/home/WxProduct/product_del/',
		data : {id:id},
		backType:'json',
		beforeSend : function(){hui.loading();},
		complete : function(){hui.closeLoading();},
		success : function(data){
			if(data.code=='sucess'){
				hui.toast('操作成功', 'success');
				var url='#{$smarty.const.ACT}#/home/WxShopMember/shop_member_show/';
				window.location.href=url;
			}else{
				hui.upToast(data.message);
			}
		},
		error : function(e){
			console.log(JSON.stringify(e));
			hui.iconToast('读取消息失败', 'warn');
		}
	});	
}
</script>
</body>
</html>